package com.example.myapplication.subsistencepayment;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.example.myapplication.Config.Commom;
import com.example.myapplication.Config.RunOnUiThreadTool;
import com.example.myapplication.R;

public class SubsistencepaymentActivity extends AppCompatActivity {

    private ImageView img;
    private EditText iphome;
    private RadioGroup radio;
    private TextView submit;
    private RecyclerView re;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_subsistencepayment);
        initview();
        //返回
        but_bloak();
        //跳转到详情页
        detailspage();
    }

    private void detailspage() {
        submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String iphomeName = iphome.getText().toString();
                Intent intent = new Intent(SubsistencepaymentActivity.this,DetailspageActivity.class);
                intent.putExtra(Commom.IPHOME,iphomeName);
                if(!"".equals(iphomeName) && !TextUtils.isEmpty(iphomeName)){
                    SubsistencepaymentActivity.this.startActivity(intent);
                }else{
                    RunOnUiThreadTool.run(SubsistencepaymentActivity.this, new RunOnUiThreadTool.RunCallback() {
                        @Override
                        public void set() {
                            Toast.makeText(SubsistencepaymentActivity.this,"请填写手机号",Toast.LENGTH_SHORT).show();
                        }
                    });
                }

            }
        });
    }

    private void but_bloak() {
        img.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SubsistencepaymentActivity.this.finish();
            }
        });
    }

    private void initview() {
        img = findViewById(R.id.img);
        radio = findViewById(R.id.radio);
        iphome = findViewById(R.id.iphome);
        submit = findViewById(R.id.submit);
        re = findViewById(R.id.re);
    }
}